<?php
//echo 'tes aja'; exit;
    //QUERY 1
    foreach ($getDetail as $z) {
        $zSdate   		   = $z["SO_SDATE"];
    	$zEdate   		   = $z["SO_EDATE"];
    	$zShours   		   = $z["SO_SHOURS"];
    	$zEhours   		   = $z["SO_EHOURS"];
    	$zShoure   		   = $z["SO_SHOURE"];
    	$zEhoure   		   = $z["SO_EHOURE"];
    	$zDescription      = $z["SO_DESCRIPTION"];
    	$zAc   			   = $z["SO_AC"];
    	$zLift   		   = $z["SO_LIFT"];
    	$zLighting   	   = $z["SO_LIGHTING"];
    	$zOther   		   = $z["SO_OTHER"];
    	$zOtherDescription = $z["SO_OTHER_DESCRIPTION"];
    	$zAtasanNik   		= $z["SO_ATASAN_NIK"];
    	$zUntukNik   		= $z["SO_UNTUK_NIK"];
    	$zComment   		= $z["SO_COMMENT"];
    	$zAtasanApp   		= $z["SO_ATASAN_APP"];
    	$zAtasanNama   		= $z["ATASANNAME"];
    	
    	$cName				= $z["NIKNAME"];
    	$cJob				= $z["NIKJOBPOSITION"];
    	$cOrg				= $z["NIKORG"];
    
    	$xNip				= $z["SO_NIP"];
    	$xName				= $z["NIPNAME"];
    	$xJob				= $z["NIPJOBPOSITION"];
    	$xOrg				= $z["NIPORG"];
    	
        //PINDAH TEMPAT KEBAWAH
    	/*
        if($zAc == 'Y'){
    	   $vAc= "checked";	
    	}
    	
    	if($zLift == 'Y'){
    	   $vLift= "checked";	
    	}
    	
    	if($zLighting == 'Y'){
    	   $vLighting= "checked";	
    	}
    	
    	if($zOther == 'Y'){
    	   $vOther= "checked";	
    	}
        */
    }
    
?>

<script>
    function cancel() {
        $.post("<?= site_url() ?>search_global", function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        });
    }
    function closeSrnKrjOvtSave() {
        $radioChecked='';
        if (document.getElementById("pApprovalY").checked == true){
            $radioChecked = "Y"; 
        }
        else{
            $radioChecked = "N";
        }
        
        $.post("<?= site_url() ?>search_global/closing_reqSave", {
            pCtrlID: $('#pCtrlID').val(),
            pCType: $('#pCType').val(),
            pApproval: $radioChecked 
            //pComment: $('#pComment').val(),
            //pAccesNo: $('#pAccesNo').val()
        },
        function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        }
        );
    }
</script>

<form id="formarea" role="form" method="post" action="#">
<input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" />
<input type="hidden" value="<?php echo $cType; ?>" id="pCType" />
<div class="col-md-offset-0" id="top">
    <div class="col-md-11">
        <div class="panel panel-default">
			<div class="panel-heading">
			<h4 class="panel-title"><b> Request By </b></h4>
			</div>
			<div class="panel-body">
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">NIK</label>
    						<div class="col-md-9"><?php echo $xNip;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nama</label>
    						<div class="col-md-9"><?php echo $xName;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Departemen</label>
    						<div class="col-md-9"><?php echo $xOrg;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Position</label>
    						<div class="col-md-9"><?php echo $xJob;?></div>
				        </div>
                    </div>                   
                </div>
                
            </div>
        </div>
        
        <div class="panel panel-default">
			<div class="panel-heading">
			<h4 class="panel-title"><b> Requestor </b></h4>
			</div>
			<div class="panel-body">
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nik</label>
    						<div class="col-md-9"><?php echo $zUntukNik;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nama</label>
    						<div class="col-md-9"><?php echo $cName;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Departemen</label>
    						<div class="col-md-9"><?php echo $cOrg;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Position</label>
    						<div class="col-md-9"><?php echo $cJob;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Tgl Overtime</label>
    						<div class="col-md-9"><?php echo $zSdate ."s/d". $zEdate;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Jam Overtime</label>
    						<div class="col-md-9"><?php echo   $zShours.":".$zEhours ."s/d". $zShoure.":".$zEhoure;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Description</label>
    						<div class="col-md-9"><?php echo nl2br($zDescription);?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Facility</label>
    						<div class="col-md-9">
                                <?php 
                                //GAk JADI DIPAKAI
                                /*if($zAc == 'Y'){
                            	   $vAc= "checked=''";	
                            	}
                            	
                            	if($zLift == 'Y'){
                            	   $vLift= "checked=''";	
                            	}
                            	
                            	if($zLighting == 'Y'){
                            	   $vLighting= "checked=''";	
                            	}
                            	
                            	if($zOther == 'Y'){
                            	   $vOther= "checked=''";	
                            	}*/
                                ?>
                                 <input type="checkbox" value="Y" disabled="" <?php if($zAc=='Y'){?>checked=""<?php } ?>  /> &nbsp;Air Conditioner<br />
			                     <input type="checkbox" value="Y" disabled="" <?php if($zLift=='Y'){?>checked=""<?php } ?> />&nbsp;Service Lift<br />
			                     <input type="checkbox" value="Y" disabled="" <?php if($zLighting=='Y'){?>checked=""<?php } ?> />&nbsp;Lighting & Power<br />
			                     <input type="checkbox" value="Y" disabled="" <?php if($zOther=='Y'){?>checked=""<?php } ?> />&nbsp;Other, Other Description :<? echo "$zOtherDescription";?>
                            </div>
				        </div>
                    </div>                   
                </div>
                  
                <div class="table-responsive">
                                <table class="table table-bordered table-condensed table-striped" style="background:#f9f9f9;">
                                    <thead>
                                        <tr>
                                            <th class="tblhead" style="width:5%;text-align:center;">No</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">Nama</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">Lantai</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">Location</th>
                                            <th class="tblhead" style="width:40%;text-align:center;">Company Name</th>
                                            <th class="tblhead" style="width:5%;text-align:center;">Service</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php
                                        $i=0;
                                        foreach ($getDetail2 as $b) {
                                                    $bSodId   		= $b["SOD_ID"];
													$bSodName   	= $b["SOD_NAME"];
													$bSodFloor   	= $b["SOD_FLOOR"];
													$bSodLocation   = $b["SOD_LOCATION"];
													$bSodVendorId   = $b["SOD_VENDOR_ID"];
													$bSodVendorName = $b["SOD_VENDOR_NAME"];
													$bSoId   		= $b["SO_ID"];
                                            ?>
                                        <tr>
                                            <td style="font-size:10px;"><?php echo ++$i; ?></td>
                                            <td style="font-size:10px;"><?php echo $bSodName; ?></td>
                                            <td style="font-size:10px;"><?php echo $bSodFloor; ?></td>
                                            <td style="font-size:10px;"><?php echo $bSodLocation; ?></td>
                                            <td style="font-size:10px;"><?php echo $bSodVendorName; ?></td>
                                            <td style="font-size:10px;"><?php echo $pSodTypePriceId; ?></td>
                                        </tr>
                                        <?php
                                        }
                                        ?>
                                    </tbody>
                                </table>
                </div>
                
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Closing Order</label>
    						<div class="col-md-9">
                            <input type="radio" name="radioApp" id="pApprovalY" value="Y"/>Yes
                            <input type="radio" name="radioApp" id="pApprovalN" value="N" checked=""/>No
                            </div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
    						<div class="col-sm-2">
                                <button type="button" class="btn btn-primary btn-block" onclick="closeSrnKrjOvtSave();">Submit</button>
                            </div>
                            <div class="col-sm-2">
                                <button type="button" class="btn btn-default btn-block" onclick="cancel();" >Cancel</button>
                            </div>
				        </div>
                    </div>                   
                </div>
            </div>
        </div>
    
    </div>
</div>
</form>
